import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_iflyad/flutter_iflyad.dart';
import 'package:flutter_iflyad/src/flutter_iflyad.dart';
import 'package:flutter_iflyad_example/banner.dart';
import 'package:flutter_iflyad_example/splash.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp() {
    FlutterIflyad.initSdk("5f48f087");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MainHome()
    );
  }
}
class MainHome extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: Center(
        child: Column(children: [
          RaisedButton(
            child: Text("banner"),
            onPressed: () {
              Navigator.push(context, MaterialPageRoute(builder: (_)=>BannerAdHome()));
            },
          ),
          RaisedButton(
            child: Text("splash"),
            onPressed: () {
              Navigator.push(context, MaterialPageRoute(builder: (_)=>SplashAdHome()));
            },
          ),
          RaisedButton(
            child: Text("Interstitial"),
            onPressed: () {
              FlutterIflyad.showInterstitialAd(adUnitId: "40AB09CDF145944A97830EE0FEF23173");
            },
          ),
          RaisedButton(
            child: Text("video"),
            onPressed: () {
              FlutterIflyad.showVideoAd(adUnitId: "7A4F300B07E2854BF13E0957133CC586");
            },
          ),
        ],),

      ),
    );
  }
}



